package com.tkjt.pms.modules.kpinew.model;

import java.util.*;

public class ViewConfig {
    public static List<String> getIndexDepartGroups(){
        String[] indexDepartGroupAttr = {"A01A01A01G01","A01A01A01G02","A01A01A01G03","A01A01A01G04","A01A01A01G05","A01A01A01G06","A01A01A01G07"};
        return Arrays.asList(indexDepartGroupAttr);
    }

    public static List<String> getbasicBepartCodes(){
        String[] getbasicBepartCodes = {"BJYY","SHSY","GZYY","SCSY","SZWY","HBCY","TKQG"};
        return Arrays.asList(getbasicBepartCodes);
    }
    public static String getBasicDepartCodeByDepartGroup(String departGroup){
        Map<String,String> departMap = new HashMap<>();
        //燕园
        departMap.put("A01A01A01G01","BJYY");
        //申园
        departMap.put("A01A01A01G02","SHSY");
        //粤园
        departMap.put("A01A01A01G03","GZYY");
        //粤园
        departMap.put("A01A01A01G04","SCSY");
        //吴园
        departMap.put("A01A01A01G05","SZWY");
        //楚园
        departMap.put("A01A01A01G06","HBCY");
        //大清谷
        departMap.put("A01A01A01G07","TKQG");
        return departMap.get(departGroup);
    }

    /**
     * 增长与价值维度查询数据结构构造
     * @return
     */
    public static List<Map<String, Object>> getDataParams1(){
        List<Map<String, Object>> dataParams = new ArrayList<>();

        Map<String,Object> data = new HashMap<>();
        List<String> indexValueCodes = new ArrayList<>();
        /**
         * 收入看板数据voi
         */
        {
            //收入情况
            //目标值
            indexValueCodes.add("KCIAAA001VB001");
            //实际值
            indexValueCodes.add("KCIAAA001VB002");
            Map<String,Object> data1 = new HashMap<>();
            data1.put("name","收入情况");
            data1.put("indexValueCodes",indexValueCodes);
            data.put("data1",data1);
            //各园区预算达成贡献度
            indexValueCodes = new ArrayList<>();
            //目标值
            indexValueCodes.add("KCIAAA001VB001");
            //实际值
            indexValueCodes.add("KCIAAA001VB002");
            Map<String,Object> data2 = new HashMap<>();
            data2.put("name","各园区预算达成贡献度(汇总)");
            data2.put("indexValueCodes",indexValueCodes);
            data.put("data2",data2);
            //园区收入占比
            indexValueCodes = new ArrayList<>();
            //实际值
            indexValueCodes.add("KCIAAA001VB002");
            Map<String,Object> data3 = new HashMap<>();
            data3.put("name","园区收入占比(汇总)");
            data3.put("indexValueCodes",indexValueCodes);
            data.put("data3",data3);
            //业态收入占比
            indexValueCodes = new ArrayList<>();
            //实际值
            indexValueCodes.add("KCIAAA001VB002");
            Map<String,Object> data4 = new HashMap<>();
            data4.put("name","业态收入占比(汇总)");
            data4.put("indexValueCodes",indexValueCodes);
            data.put("data4",data4);
            getChildParamData1(data,data1,data2,data3,"收入");
            dataParams.add(data);

        }
        /**
         * EBITDA看板数据
         */
        {
            data = new HashMap<>();
            //收入情况
            indexValueCodes = new ArrayList<>();
            //目标值
            indexValueCodes.add("KCIAAA002VB001");
            //实际值
            indexValueCodes.add("KCIAAA002VB002");
            Map<String,Object> data1 = new HashMap<>();
            data1.put("name","EBITDA情况");
            data1.put("indexValueCodes",indexValueCodes);
            data.put("data1",data1);
            //各园区预算达成贡献度
            indexValueCodes = new ArrayList<>();
            //目标值
            indexValueCodes.add("KCIAAA002VB001");
            //实际值
            indexValueCodes.add("KCIAAA002VB002");
            Map<String,Object> data2 = new HashMap<>();
            data2.put("name","各园区预算达成贡献度(汇总)");
            data2.put("indexValueCodes",indexValueCodes);
            data.put("data2",data2);
            //园区收入占比
            indexValueCodes = new ArrayList<>();
            //实际值
            indexValueCodes.add("KCIAAA002VB002");
            Map<String,Object> data3 = new HashMap<>();
            data3.put("name","园区EBITDA占比(汇总)");
            data3.put("indexValueCodes",indexValueCodes);
            data.put("data3",data3);
            //业态收入占比
            indexValueCodes = new ArrayList<>();
            //实际值
            indexValueCodes.add("KCIAAA002VB002");
            Map<String,Object> data4 = new HashMap<>();
            data4.put("name","业态EBITDA占比(汇总)");
            data4.put("indexValueCodes",indexValueCodes);
            data.put("data4",data4);
            getChildParamData1(data,data1,data2,data3,"EBITDA");
            dataParams.add(data);
        }
        /**
         * 销售看板数据
         */
        {
            data = new HashMap<>();
            indexValueCodes = new ArrayList<>();
            //净新增入住 目标值
            indexValueCodes.add("KCIAAA004VA001");
            //净新增入住 实际值
            indexValueCodes.add("KCIAAA004VA002");
            //床位使用率 目标值
            indexValueCodes.add("KCIAAA006VA001");
            //床位使用率 实际值
            indexValueCodes.add("KCIAAA006VA002");
            Map<String,Object> data1 = new HashMap<>();
            data1.put("name","销售情况");
            data1.put("indexValueCodes",indexValueCodes);
            data.put("data1",data1);
            //各园区预算达成贡献度
            indexValueCodes = new ArrayList<>();
            //净新增入住 目标值
            indexValueCodes.add("KCIAAA004VA001");
            //净新增入住 实际值
            indexValueCodes.add("KCIAAA004VA002");
            //床位使用率 目标值
            indexValueCodes.add("KCIAAA006VA001");
            //床位使用率 实际值
            indexValueCodes.add("KCIAAA006VA002");
            Map<String,Object> data2 = new HashMap<>();
            data2.put("name","各园区预算达成贡献度(汇总)");
            data2.put("indexValueCodes",indexValueCodes);
            data.put("data2",data2);
            //园区收入占比
            indexValueCodes = new ArrayList<>();
            //净新增入住 实际值
            indexValueCodes.add("KCIAAA004VA002");
            //床位使用率 实际值
            indexValueCodes.add("KCIAAA006VA002");
            Map<String,Object> data3 = new HashMap<>();
            data3.put("name","园区销售占比(汇总)");
            data3.put("indexValueCodes",indexValueCodes);
            data.put("data3",data3);
            //业态收入占比
            indexValueCodes = new ArrayList<>();
            //净新增入住 实际值
            indexValueCodes.add("KCIAAA004VA002");
            //床位使用率 实际值
            indexValueCodes.add("KCIAAA006VA002");
            Map<String,Object> data4 = new HashMap<>();
            data4.put("name","业态销售占比(汇总)");
            data4.put("indexValueCodes",indexValueCodes);
            data.put("data4",data4);
            getChildParamData1(data,data1,data2,data3,"销售");
            dataParams.add(data);
        }
        return dataParams;
    }

    /**
     * 融合与业态维度查询数据结构构造
     * @return
     */
    public static Map<String, Object> getDataParams2(){
        Map<String, Object> dataParam = new HashMap<>();
        List<String> indexValueCodes = new ArrayList<>();
        Map<String,Object> data1 = new HashMap<>();
        /**
         * 收入看板数据voi
         */
        {
            //收入情况
            //目标值
            indexValueCodes.add("KCIAAA001VB001");
            //实际值
            indexValueCodes.add("KCIAAA001VB002");
            data1.put("name","整体收入");
            data1.put("indexValueCodes",indexValueCodes);
            dataParam.put("data1",data1);
        }
        /**
         * EBITDA看板数据
         */
        Map<String,Object> data2 = new HashMap<>();
        {
            //收入情况
            indexValueCodes = new ArrayList<>();
            //目标值
            indexValueCodes.add("KCIAAA002VB001");
            //实际值
            indexValueCodes.add("KCIAAA002VB002");
            data2.put("name","整体EBITDA");
            data2.put("indexValueCodes",indexValueCodes);
            dataParam.put("data2",data2);
        }
        /**
         * 销售看板数据
         */
        Map<String,Object> data3 = new HashMap<>();
        {
            //收入情况
            indexValueCodes = new ArrayList<>();
            //净新增入住 目标值
            indexValueCodes.add("KCIAAA004VA001");
            //净新增入住 实际值
            indexValueCodes.add("KCIAAA004VA002");
            //床位使用率 目标值
            indexValueCodes.add("KCIAAA006VA001");
            //床位使用率 实际值
            indexValueCodes.add("KCIAAA006VA002");
            data3.put("name","整体销售");
            data3.put("indexValueCodes",indexValueCodes);
            dataParam.put("data3",data3);
        }
        List<Map<String,Object>> childList = new ArrayList<>();
        childList.add(getChildParamData2(data1,data2,data3,"ATRD1001","独立"));
        childList.add(getChildParamData2(data1,data2,data3,"ATRD1002","护理"));
        childList.add(getChildParamData2(data1,data2,data3,"ATRD1003","医院"));
        dataParam.put("child",childList);
        return dataParam;
    }

    public static void getChildParamData1(Map<String,Object> data,Map<String,Object> data1,Map<String,Object> data2,Map<String,Object> data3,String indexCodeName){
        List<Map<String,Object>> child = new ArrayList<>();
        Map<String,Object> data11 = new HashMap<>();
        Map<String,Object> data12 = new HashMap<>();
        Map<String,Object> data13 = new HashMap<>();
        String departBiz1 = "ATRD1001";
        data11.put("name","独立"+indexCodeName);
        data11.put("indexValueCodes",data1.get("indexValueCodes"));
        data12.put("name",data2.get("name"));
        data12.put("indexValueCodes",data2.get("indexValueCodes"));
        data13.put("name",data3.get("name"));
        data13.put("indexValueCodes",data3.get("indexValueCodes"));
        Map<String,Object> childData = new HashMap<>();
        childData.put("data1",data11);
        childData.put("data2",data12);
        childData.put("data3",data13);
        childData.put("departBiz",departBiz1);
        child.add(childData);
        Map<String,Object> data21 = new HashMap<>();
        Map<String,Object> data22 = new HashMap<>();
        Map<String,Object> data23 = new HashMap<>();
        String departBiz2 = "ATRD1002";
        data21.put("name","护理"+indexCodeName);
        data21.put("indexValueCodes",data1.get("indexValueCodes"));
        data22.put("name",data2.get("name"));
        data22.put("indexValueCodes",data2.get("indexValueCodes"));
        data23.put("name",data3.get("name"));
        data23.put("indexValueCodes",data3.get("indexValueCodes"));
        childData = new HashMap<>();
        childData.put("data1",data21);
        childData.put("data2",data22);
        childData.put("data3",data23);
        childData.put("departBiz",departBiz2);
        child.add(childData);
        Map<String,Object> data31 = new HashMap<>();
        Map<String,Object> data32 = new HashMap<>();
        Map<String,Object> data33 = new HashMap<>();
        String departBiz3 = "ATRD1003";
        data31.put("name","医院"+indexCodeName);
        data31.put("indexValueCodes",data1.get("indexValueCodes"));
        data32.put("name",data2.get("name"));
        data32.put("indexValueCodes",data2.get("indexValueCodes"));
        data33.put("name",data3.get("name"));
        data33.put("indexValueCodes",data3.get("indexValueCodes"));
        childData = new HashMap<>();
        childData.put("data1",data31);
        childData.put("data2",data32);
        childData.put("data3",data33);
        childData.put("departBiz",departBiz3);
        child.add(childData);
        data.put("child",child);
    }

    public static Map<String,Object> getChildParamData2(Map<String,Object> data1,Map<String,Object> data2,Map<String,Object> data3,String departBiz,String departBizName){
        Map<String,Object> data11 = new HashMap<>();
        Map<String,Object> data12 = new HashMap<>();
        Map<String,Object> data13 = new HashMap<>();
        data11.put("name",departBizName+"收入");
        data11.put("indexValueCodes",data1.get("indexValueCodes"));
        data12.put("name",departBizName+"EBITDA");
        data12.put("indexValueCodes",data2.get("indexValueCodes"));
        data13.put("name",departBizName+"销售");
        data13.put("indexValueCodes",data3.get("indexValueCodes"));
        Map<String,Object> childData = new HashMap<>();
        childData.put("data1",data11);
        childData.put("data2",data12);
        childData.put("data3",data13);
        childData.put("departBiz",departBiz);
        return childData;
    }
}
